//
//  DetailedInfoViewController.m
//  FMS
//
//  Created by Steven on 10/15/13.
//  Copyright (c) 2013 QGSVN. All rights reserved.
//

#import "DetailedInfoViewController.h"
#import "DetailedItemViewController.h"
#import "BuildingMgmtViewController.h"

@interface DetailedInfoViewController ()

@end

@implementation DetailedInfoViewController
@synthesize itemDetailedDict;
@synthesize mainTableView;
@synthesize parent;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil itemType:(int)_itemType parent:(id)_parent
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
        dictLanguage = [ApplicationDelegate.arrayLanguage objectAtIndex:0];
        itemType = _itemType;
        parent = _parent;
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    mainTableView.separatorColor = APPLE_BLUE_COLOR;
    
    mainArray = [NSMutableArray arrayWithCapacity:1];
    
    if (itemType == Building_Type){
        //there are 16 rows
        NSString *lbTitle[] = {
            [dictLanguage objectForKey:@"building-mgmt.add-new-room.room-name"],
            [dictLanguage objectForKey:@"schedule.title-service"],
            [dictLanguage objectForKey:@"schedule.title-camp"],
            [dictLanguage objectForKey:@"schedule.title-unit"],
            [dictLanguage objectForKey:@"schedule.title-building"],
            [dictLanguage objectForKey:@"schedule.title-floor"],
            [dictLanguage objectForKey:@"building-mgmt.add-new-room.type"],
            [dictLanguage objectForKey:@"building-mgmt.add-new-room.normal-ops-critical"],
            [dictLanguage objectForKey:@"building-mgmt.add-new-room.square-metres"],
            [dictLanguage objectForKey:@"building-mgmt.add-new-room.date-of-completion"],
            [dictLanguage objectForKey:@"building-mgmt.add-new-room.warranty-date-exp"],
            [dictLanguage objectForKey:@"building-mgmt.add-new-room.construction-cost"],
            [dictLanguage objectForKey:@"building-mgmt.add-new-room.age"],
            [dictLanguage objectForKey:@"building-mgmt.add-new-room.cost-incurred-previous-year"],
            [dictLanguage objectForKey:@"building-mgmt.add-new-room.cost-incurred-current-year"],
            [dictLanguage objectForKey:@"building-mgmt.add-new-room.date-of-demolition"],
            [dictLanguage objectForKey:@"building-mgmt.add-new-room.demolition-reason"],
            [dictLanguage objectForKey:@"building-mgmt.add-new-room.contractor"],
        };
        
        //assign value to objectValue
        NSMutableArray *objectValue = [NSMutableArray arrayWithCapacity:1];
        
        //calculation new age for room if greater > 1 yrs since date of completion
        NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
        [dateFormatter setDateFormat:@"MMM dd, yyyy"];
        NSDate *dateOfCompletion = [NSDate dateFormatDateDisplayFromString:[itemDetailedDict objectForKey:@"date_of_completion"]];
        if (dateOfCompletion == nil)
            dateOfCompletion = [NSDate date];
        
        NSDate* now = [NSDate date];
        NSDateComponents* ageComponents = [[NSCalendar currentCalendar]
                                           components:NSYearCalendarUnit
                                           fromDate:dateOfCompletion
                                           toDate:now
                                           options:0];
        NSInteger age = [ageComponents year];
        
        NSString *newAge = [NSString stringWithFormat:@"%d",age];
        if ([newAge intValue] < 0)
            newAge = @"0";
        
        NSString *itemName = [itemDetailedDict objectForKey:@"item_name"] == nil ? [itemDetailedDict objectForKey:@"roomName"] : [itemDetailedDict objectForKey:@"item_name"];
        [objectValue addObject:itemName];
        [objectValue addObject:[itemDetailedDict objectForKey:@"service"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"camp"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"unit"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"building"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"floor"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"type"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"normal_ops"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"square_metres"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"date_of_completion"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"date_of_exp"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"construction_cost"]];
        [objectValue addObject:newAge];
        [objectValue addObject:[itemDetailedDict objectForKey:@"cost_incurred_previous_year"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"cost_incurred_current_year"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"date_of_demolition"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"demolition_reason"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"contractor"]];
        //initialize dictionary to store these value
        for (int i=0;i < sizeof(lbTitle)/sizeof(lbTitle[0]);i++) {
            NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithObjectsAndKeys:lbTitle[i],@"labelTitle",[objectValue objectAtIndex:i],@"objectValue", nil];
            [mainArray addObject:dict];
        }
    }
    else {
        BOOL isOther = [[itemDetailedDict objectForKey:@"isOther"] boolValue];
        //there are 27 rows
        NSString *lbTitle[] = {
            [dictLanguage objectForKey:@"facility.add-new-equipment.equipment-id"],
            [dictLanguage objectForKey:@"schedule.title-service"],
            [dictLanguage objectForKey:@"schedule.title-camp"],
            [dictLanguage objectForKey:@"schedule.title-unit"],
            [dictLanguage objectForKey:@"schedule.title-building"],
            [dictLanguage objectForKey:@"schedule.title-floor"],
            [dictLanguage objectForKey:@"schedule.title-room"],
            [dictLanguage objectForKey:@"facility.add-new-equipment.system"],
            [dictLanguage objectForKey:@"facility.add-new-equipment.description"],
            [dictLanguage objectForKey:@"facility.add-new-equipment.brand"],
            [dictLanguage objectForKey:@"facility.add-new-equipment.serial"],
            [dictLanguage objectForKey:@"facility.add-new-equipment.make-model"],
            [dictLanguage objectForKey:@"facility.add-new-equipment.capacity"],
            [dictLanguage objectForKey:@"facility.add-new-equipment.expiry-date"],
            [dictLanguage objectForKey:@"facility.add-new-equipment.manufacture-detail"],
            [dictLanguage objectForKey:@"facility.add-new-equipment.agent-detail"],
            [dictLanguage objectForKey:@"facility.add-new-equipment.normal-critical"],
            [dictLanguage objectForKey:@"facility.add-new-equipment.capital-cost"],
            [dictLanguage objectForKey:@"facility.add-new-equipment.date-of-installation"],
            [dictLanguage objectForKey:@"facility.add-new-equipment.age"],
            [dictLanguage objectForKey:@"facility.add-new-equipment.amp-frequency"],
            [dictLanguage objectForKey:@"facility.add-new-equipment.amp-budciet"],
            [dictLanguage objectForKey:@"facility.add-new-equipment.cost-incurred-previous-year"],
            [dictLanguage objectForKey:@"facility.add-new-equipment.cost-incurred-current-year"],
            [dictLanguage objectForKey:@"facility.add-new-equipment.date-of-condemnation"],
            [dictLanguage objectForKey:@"facility.add-new-equipment.condemnation-reason"],
            [dictLanguage objectForKey:@"facility.add-new-equipment.contractor"],
        };
        
        //assign value to objectValue
        NSMutableArray *objectValue = [NSMutableArray arrayWithCapacity:1];
        
        //calculation new age for room if greater > 1 yrs since date of completion
        NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
        [dateFormatter setDateFormat:@"MMM dd, yyyy"];
        NSDate *dateOfInstallation = [NSDate dateFormatDateDisplayFromString:[itemDetailedDict objectForKey:@"date_of_installation"]];
        if (dateOfInstallation == nil)
            dateOfInstallation = [NSDate date];
        
        NSDate* now = [NSDate date];
        NSDateComponents* ageComponents = [[NSCalendar currentCalendar]
                                           components:NSYearCalendarUnit
                                           fromDate:dateOfInstallation
                                           toDate:now
                                           options:0];
        NSInteger age = [ageComponents year];
        
        NSString *newAge = [NSString stringWithFormat:@"%d",age];
        if ([newAge intValue] < 0)
            newAge = @"0";

        NSString *itemName = [itemDetailedDict objectForKey:@"item_name"] == nil ? [itemDetailedDict objectForKey:@"name"] : [itemDetailedDict objectForKey:@"item_name"];
        [objectValue addObject:itemName];
        [objectValue addObject:[itemDetailedDict objectForKey:@"service"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"camp"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"unit"]];
        
        if (isOther)
            [objectValue addObject:[dictLanguage objectForKey:@"filter.select-building.other"]];
        else
            [objectValue addObject:[itemDetailedDict objectForKey:@"building"]];
        
        [objectValue addObject:[itemDetailedDict objectForKey:@"floor"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"room"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"system"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"description"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"brand"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"serial_no"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"make_model"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"capacity"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"date_of_exp"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"manufacturer_detail"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"agent_detail"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"normal_ops"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"capital_cost"]];
        
        @try {
            [objectValue addObject:[itemDetailedDict objectForKey:@"date_of_installation"]];
        }
        @catch (NSException *e) {
            NSLog(@"date_of_installation = %@",e);
            [objectValue addObject:@""];
        }
        [objectValue addObject:newAge];
        [objectValue addObject:[itemDetailedDict objectForKey:@"amp_frequency"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"amp_budciet"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"cost_incurred_previous_year"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"cost_incurred_current_year"]];
        
        @try {
            [objectValue addObject:[itemDetailedDict objectForKey:@"date_of_condemnation"]];
        }
        @catch (NSException *e) {
            NSLog(@"date_of_condemnation = %@",e);
            [objectValue addObject:@""];
        }
        
        [objectValue addObject:[itemDetailedDict objectForKey:@"condemnation_reason"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"contractor"]];
        
        //initialize dictionary to store these value
        for (int i=0;i < sizeof(lbTitle)/sizeof(lbTitle[0]);i++) {
            NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithObjectsAndKeys:lbTitle[i],@"labelTitle",objectValue[i],@"objectValue", nil];
            [mainArray addObject:dict];
        }
        
        //reload data when building = other
        
        if (isOther) {
            //remove floor and room row: index = 5 & 6
            NSMutableArray *tmpIndexPaths = [NSMutableArray arrayWithCapacity:1];
            NSIndexPath *path1 = [NSIndexPath indexPathForRow:5 inSection:0];
            NSIndexPath *path2 = [NSIndexPath indexPathForRow:6 inSection:0];
            [tmpIndexPaths addObject:path1];
            
            //if select Room, only remove floor row
            if (itemType != Building_Type)
                [tmpIndexPaths addObject:path2];
            
            //delete floor,room
            if ([tmpIndexPaths count] > 0) {
                NSMutableIndexSet *indexSet = [NSMutableIndexSet indexSet];
                [indexSet addIndex:5];
                
                //if select Room, only remove floor row
                if (itemType != Building_Type)
                    [indexSet addIndex:6];
                
                [mainArray removeObjectsAtIndexes:indexSet];
                [self.mainTableView deleteRowsAtIndexPaths:tmpIndexPaths withRowAnimation:UITableViewRowAnimationAutomatic];
                
                //add other building row
                [tmpIndexPaths removeAllObjects];
                NSIndexPath *path3 = [NSIndexPath indexPathForRow:5 inSection:0];
                [tmpIndexPaths addObject:path3];
                
                NSMutableDictionary *locationDict = [NSMutableDictionary dictionaryWithObjectsAndKeys:@"",@"labelTitle",[NSNumber numberWithInt:filter_location],@"objectType",[itemDetailedDict objectForKey:@"building"],@"objectValue", nil];
                [mainArray insertObject:locationDict atIndex:5];
                
                [self.mainTableView insertRowsAtIndexPaths:tmpIndexPaths withRowAnimation:UITableViewRowAnimationAutomatic];
            }
        }
        
    }
}

- (void) reloadAfterUpdate:(NSMutableDictionary*)_dict {
    [mainArray removeAllObjects];
    itemDetailedDict = _dict;
    ((DetailedItemViewController*)parent).itemDetailedDict = itemDetailedDict;
    
    //update tableview at Building Mgmt
    BuildingMgmtViewController *controller = [((DetailedItemViewController*)parent).navigationController.viewControllers objectAtIndex:0];
    [controller reloadAfterUpdate:_dict];
    
    if (itemType == Building_Type){
        //there are 16 rows
        NSString *lbTitle[] = {
            [dictLanguage objectForKey:@"building-mgmt.add-new-room.room-name"],
            [dictLanguage objectForKey:@"schedule.title-service"],
            [dictLanguage objectForKey:@"schedule.title-camp"],
            [dictLanguage objectForKey:@"schedule.title-unit"],
            [dictLanguage objectForKey:@"schedule.title-building"],
            [dictLanguage objectForKey:@"schedule.title-floor"],
            [dictLanguage objectForKey:@"building-mgmt.add-new-room.type"],
            [dictLanguage objectForKey:@"building-mgmt.add-new-room.normal-ops-critical"],
            [dictLanguage objectForKey:@"building-mgmt.add-new-room.square-metres"],
            [dictLanguage objectForKey:@"building-mgmt.add-new-room.date-of-completion"],
            [dictLanguage objectForKey:@"building-mgmt.add-new-room.warranty-date-exp"],
            [dictLanguage objectForKey:@"building-mgmt.add-new-room.construction-cost"],
            [dictLanguage objectForKey:@"building-mgmt.add-new-room.age"],
            [dictLanguage objectForKey:@"building-mgmt.add-new-room.cost-incurred-previous-year"],
            [dictLanguage objectForKey:@"building-mgmt.add-new-room.cost-incurred-current-year"],
            [dictLanguage objectForKey:@"building-mgmt.add-new-room.date-of-demolition"],
            [dictLanguage objectForKey:@"building-mgmt.add-new-room.demolition-reason"],
            [dictLanguage objectForKey:@"building-mgmt.add-new-room.contractor"],
        };
        
        //assign value to objectValue
        NSMutableArray *objectValue = [NSMutableArray arrayWithCapacity:1];
        
        NSString *itemName = [itemDetailedDict objectForKey:@"item_name"] == nil ? [itemDetailedDict objectForKey:@"roomName"] : [itemDetailedDict objectForKey:@"item_name"];
        [objectValue addObject:itemName];
        [objectValue addObject:[itemDetailedDict objectForKey:@"service"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"camp"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"unit"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"building"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"floor"]];
//        [objectValue addObject:[itemDetailedDict objectForKey:@"room"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"type"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"normal_ops"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"square_metres"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"date_of_completion"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"date_of_exp"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"construction_cost"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"age"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"cost_incurred_previous_year"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"cost_incurred_current_year"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"date_of_demolition"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"demolition_reason"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"contractor"]];
        
        //initialize dictionary to store these value
        for (int i=0;i < sizeof(lbTitle)/sizeof(lbTitle[0]);i++) {
            NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithObjectsAndKeys:lbTitle[i],@"labelTitle",[objectValue objectAtIndex:i],@"objectValue", nil];
            [mainArray addObject:dict];
        }
    }
    else {
        //there are 27 rows
        NSString *lbTitle[] = {
            [dictLanguage objectForKey:@"facility.add-new-equipment.equipment-id"],
            [dictLanguage objectForKey:@"schedule.title-service"],
            [dictLanguage objectForKey:@"schedule.title-camp"],
            [dictLanguage objectForKey:@"schedule.title-unit"],
            [dictLanguage objectForKey:@"schedule.title-building"],
            [dictLanguage objectForKey:@"schedule.title-floor"],
            [dictLanguage objectForKey:@"schedule.title-room"],
            [dictLanguage objectForKey:@"facility.add-new-equipment.system"],
            [dictLanguage objectForKey:@"facility.add-new-equipment.description"],
            [dictLanguage objectForKey:@"facility.add-new-equipment.brand"],
            [dictLanguage objectForKey:@"facility.add-new-equipment.serial"],
            [dictLanguage objectForKey:@"facility.add-new-equipment.make-model"],
            [dictLanguage objectForKey:@"facility.add-new-equipment.capacity"],
            [dictLanguage objectForKey:@"facility.add-new-equipment.expiry-date"],
            [dictLanguage objectForKey:@"facility.add-new-equipment.manufacture-detail"],
            [dictLanguage objectForKey:@"facility.add-new-equipment.agent-detail"],
            [dictLanguage objectForKey:@"facility.add-new-equipment.normal-critical"],
            [dictLanguage objectForKey:@"facility.add-new-equipment.capital-cost"],
            [dictLanguage objectForKey:@"facility.add-new-equipment.date-of-installation"],
            [dictLanguage objectForKey:@"facility.add-new-equipment.age"],
            [dictLanguage objectForKey:@"facility.add-new-equipment.amp-frequency"],
            [dictLanguage objectForKey:@"facility.add-new-equipment.amp-budciet"],
            [dictLanguage objectForKey:@"facility.add-new-equipment.cost-incurred-previous-year"],
            [dictLanguage objectForKey:@"facility.add-new-equipment.cost-incurred-current-year"],
            [dictLanguage objectForKey:@"facility.add-new-equipment.date-of-condemnation"],
            [dictLanguage objectForKey:@"facility.add-new-equipment.condemnation-reason"],
            [dictLanguage objectForKey:@"facility.add-new-equipment.contractor"],
        };
        
        //assign value to objectValue
        NSMutableArray *objectValue = [NSMutableArray arrayWithCapacity:1];
        NSString *itemName = [itemDetailedDict objectForKey:@"item_name"] == nil ? [itemDetailedDict objectForKey:@"name"] : [itemDetailedDict objectForKey:@"item_name"];
        [objectValue addObject:itemName];
        [objectValue addObject:[itemDetailedDict objectForKey:@"service"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"camp"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"unit"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"building"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"floor"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"room"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"system"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"description"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"brand"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"serial_no"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"make_model"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"capacity"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"date_of_exp"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"manufacturer_detail"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"agent_detail"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"normal_ops"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"capital_cost"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"date_of_installation"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"age"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"amp_frequency"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"amp_budciet"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"cost_incurred_previous_year"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"cost_incurred_current_year"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"date_of_condemnation"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"condemnation_reason"]];
        [objectValue addObject:[itemDetailedDict objectForKey:@"contractor"]];
        
        //initialize dictionary to store these value
        for (int i=0;i < sizeof(lbTitle)/sizeof(lbTitle[0]);i++) {
            NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithObjectsAndKeys:lbTitle[i],@"labelTitle",objectValue[i],@"objectValue", nil];
            [mainArray addObject:dict];
        }
    }
    [mainTableView reloadData];
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    // Return the number of sections.
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    // Return the number of rows in the section.
    return [mainArray count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";
    //    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
    
    UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
    // Configure the cell...
    NSMutableDictionary *dict = [mainArray objectAtIndex:indexPath.row];
    
    UILabel *lbTitle = [[UILabel alloc] initWithFrame:CGRectMake(150, 25, 350, 21)];
    lbTitle.backgroundColor = [UIColor clearColor];
    lbTitle.text = [dict objectForKey:@"labelTitle"];
    lbTitle.textColor = [UIColor darkGrayColor];
    lbTitle.font = [UIFont boldSystemFontOfSize:15];
    [cell.contentView addSubview:lbTitle];
    
    UILabel *lbValue = [[UILabel alloc] initWithFrame:CGRectMake(500, 25, 350, 21)];
    lbValue.backgroundColor = [UIColor clearColor];
    
    if (([[dict objectForKey:@"labelTitle"] isEqualToString:[dictLanguage objectForKey:@"schedule.title-floor"]] || [[dict objectForKey:@"labelTitle"] isEqualToString:[dictLanguage objectForKey:@"schedule.title-room"]]) && [[dict objectForKey:@"objectValue"] isEqualToString:@"0"])
        lbValue.text = @"";
    else
        lbValue.text = [NSString stringWithFormat:@"%@",[dict objectForKey:@"objectValue"]];
    lbValue.textColor = [UIColor darkGrayColor];
    [cell.contentView addSubview:lbValue];
    
    cell.userInteractionEnabled = NO;
    return cell;
}


@end
